package com.huan.iteye.service.impl;

import com.huan.iteye.domain.IteyeBlogTotalViews;
import com.huan.iteye.repository.IteyeBlogTotalViewsRepository;
import com.huan.iteye.service.IteyeBlogTotalViewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 每天博客访问总量 service impl
 *
 * @author huan.fu
 * @date 2018/9/14 - 16:42
 */
@Service
public class IteyeBlogTotalViewsServiceImpl implements IteyeBlogTotalViewsService {

	@Autowired
	private IteyeBlogTotalViewsRepository blogTotalViewsRepository;

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void addIteyeBlogTotalView(IteyeBlogTotalViews record) {
		blogTotalViewsRepository.save(record);
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void deleteIteyeBlogTotalView(String workDate) {
		blogTotalViewsRepository.deleteByWorkDate(workDate);
	}
}
